 
 

 
 function sum2 (arr){
      var  sum = function(){ 
          return arr.reduce(
              function(x,y){
            return x + y ;
      

        });

    }
    return sum;
 }
   
var f = sum2([1,23,,4])

    console.log(f);

/*    function sum(arr) {
        return arr.reduce(function (x, y) {
            return x + y;
        });
    }
    
 //   sum([1, 2, 3, 4, 5]); // 15

 var f = sum([1,2,34,])

 console.log(f)
 */